/*
 *接口编写处...
*如果接口需要做Action的权限验证，请在Action上使用属性
*如: [ApiActionPermission("qx_peijian",Enums.ActionPermissionOptions.Search)]
 */
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Http;
using VOL.Entity.DomainModels;
using VOL.Miyao.IServices;
using Orther.BLL.Miyao;
using Orther.Model.param;
using Project.Utils;
using VOL.Core.Filters;

namespace VOL.Miyao.Controllers
{
    public partial class qx_peijianController
    {
        private readonly Iqx_peijianService _service;//访问业务代码
        private readonly IHttpContextAccessor _httpContextAccessor;
        private PeijianBLL peijianBLL = new PeijianBLL();

        [ActivatorUtilitiesConstructor]
        public qx_peijianController(
            Iqx_peijianService service,
            IHttpContextAccessor httpContextAccessor
        )
        : base(service)
        {
            _service = service;
            _httpContextAccessor = httpContextAccessor;
        }



        [ApiActionPermission(Core.Enums.ActionPermissionOptions.Search)]
        [HttpGet, Route("GetPageDataZjc")]
        public ActionResult GetPageDataZjc(PeijianParam param, Pagination pagination)
        {
            TData<List<qx_peijian>> obj = peijianBLL.GetPageList(param, pagination);
            return JsonNormal(obj);
        }


        [ApiActionPermission(Core.Enums.ActionPermissionOptions.Search)]
        [HttpGet, Route("GetObjectJson")]
        public async Task<ActionResult> GetObjectJson(PeijianParam param)
        {
            TData<qx_peijian> obj = await peijianBLL.GetObject(param);
            return JsonNormal(obj);
        }

        [ApiActionPermission(Core.Enums.ActionPermissionOptions.Update)]
        [HttpPost, Route("SaveFormJson")]
        public ActionResult SaveFormJson([FromBody] qx_peijian entity)
        {
            TData obj = peijianBLL.SaveForm(entity);
            return JsonNormal(obj);
        }


        [ApiActionPermission(Core.Enums.ActionPermissionOptions.Delete)]
        [HttpGet, Route("DeleteFromJson")]
        public async Task<ActionResult> DeleteFromJson(Guid id)
        {
            TData obj = await peijianBLL.deleteFrom(id);
            return JsonNormal(obj);
        }


    }
}
